www.gusucode.com > VC++仿XP免费Prof UIS界面库-源码程序 > VC++仿XP免费Prof UIS界面库-源码程序/code/Samples/ProfUIS_Controls/ProfUIS_Controls.cpp

    //Download by http://www.NewXing.com
// ProfUIS_Controls.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "ProfUIS_Controls.h"
#include "MainDlg.h"

#include <ExtCmdManager.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainApp

BEGIN_MESSAGE_MAP(CMainApp, CWinApp)
	//{{AFX_MSG_MAP(CMainApp)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainApp construction

CMainApp::CMainApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CMainApp object

CMainApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CMainApp initialization

BOOL CMainApp::InitInstance()
{
///	if( !C ,,, ::InitInstance() )
///		return FALSE;

	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#if _MFC_VER < 0x700
	#ifdef _AFXDLL
		Enable3dControls();			// Call this when using MFC in a shared DLL
	#else
		Enable3dControlsStatic();	// Call this when linking to MFC statically
	#endif
#endif

	SetRegistryKey( _T("Foss") );

	VERIFY(
		g_CmdManager->ProfileSetup(
			m_pszRegistryKey
			)
		);

	VERIFY(
		g_CmdManager->UpdateFromMenu(
			m_pszRegistryKey,
			IDR_MENU1
			)
		);
	VERIFY(
		g_CmdManager->UpdateFromMenu(
			m_pszRegistryKey,
			IDR_MENU2
			)
		);
	VERIFY(
		g_CmdManager->UpdateFromMenu(
			m_pszRegistryKey,
			IDR_MENU3
			)
		);

	static UINT basic_commands[] =
	{
		ID_APP_ABOUT,
		IDC_CHECK_SHOW_IN_TRAY,
		IDC_ENABLE_DIALOG_CONTEXT_MENU,
		ID_OWNERDRAW_ITEM,

		ID_HEIGHT_8PX,
		ID_HEIGHT_10PX,
		ID_HEIGHT_12PX,
		ID_HEIGHT_14PX,
		ID_HEIGHT_16PX,
		ID_HEIGHT_18PX,
		ID_HEIGHT_20PX,
		ID_HEIGHT_22PX,
		ID_HEIGHT_24PX,
		ID_HEIGHT_26PX,
		ID_HEIGHT_28PX,
		ID_HEIGHT_30PX,

		ID_COLOR_BTN_HEIGHT,

		0 // end of list
	};

CExtCmdItem * pCmdItem =
		g_CmdManager->CmdAllocPtr(
			m_pszRegistryKey,
			ID_COLOR_BTN_HEIGHT
			);
	ASSERT( pCmdItem != NULL );
	pCmdItem->m_sToolbarText = pCmdItem->m_sMenuText
		= pCmdItem->m_sTipStatus = pCmdItem->m_sTipTool
		= _T( "Color cell height" );

	VERIFY(
		g_CmdManager->SetBasicCommands(
			m_pszRegistryKey,
			basic_commands
			)
		);
	
	CMainDlg dlg;
	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with OK
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO: Place code here to handle when the dialog is
		//  dismissed with Cancel
	}

	// Since the dialog has been closed, return FALSE so that we exit the
	//  application, rather than start the application's message pump.
	return FALSE;
}